<script setup lang="ts">
import { ref,onMounted, reactive, defineProps } from 'vue'
import { getTransitionFields } from '@/api/dict'

const props = defineProps(["transitionInfo"])
console.log('==========================')
console.log(props)
console.log('==========================')

let fieldsRequired = reactive({})

onMounted(() => {
  console.log(`the component is now mounted`,)
  console.log(props)
})

async function getTransitionRequiredFields(issueKey: string, transitionId: string) {
  console.log("start request")
  const resp = await getTransitionFields({
    'issueKey': issueKey,
    'toTransitionId': transitionId
  })

  console.log(resp)

  // const fields = resp.data.transitions[0]?.fields || null
  //
  // fieldsRequired = Object.values(fields || {})
  //   .filter((field: any) => field.key !== 'assignee') // Exclude fields with name "test"
  //   .map((field: any) => ({
  //     title: field.name,
  //     name: field.key,
  //     required: field.required,
  //     autoCompleteUrl: field.autoCompleteUrl,
  //     schema: field.schema,
  //     allowedValues: field.allowedValues
  //   }))

  console.log(fieldsRequired)
}

</script>

<template>
  <h1> this is a test</h1>
</template>

<style scoped lang="scss">

</style>
